package com.secondkill.controller;

import com.secondkill.result.Result;
import com.secondkill.service.MiaoshaUserService;
import com.secondkill.vo.LoginVo;
import com.sun.deploy.net.HttpResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;

/**
 * Created by IBM on 2018/7/5.
 */
@Controller
public class LoginController {

    @Autowired
    MiaoshaUserService miaoshaUserService;

    @PostMapping("/login/do_login")
    @ResponseBody
    public Result<Boolean> doLogin(HttpServletResponse response, @Valid LoginVo loginVo) {

        Boolean aBoolean = miaoshaUserService.doLogin(response, loginVo);
        return Result.success(aBoolean);
    }
}
